#!/usr/bin/env python
# -*- coding: utf-8 -*-

# @Time     :2022/03/16
# @Author   :Changshu
# @File     :Exercise452.py

# def a():


def findMinArrowShots(points: list) -> int:
	if not points:
		return 0

	points.sort(key=lambda a: a[1])
	res = 0
	burst = [0] * len(points)
	while 0 in burst:
		i = burst.index(0)
		arrow = points[i][1]
		for j in range(i, len(points)):
			point = points[j]
			if point[0] <= arrow and point[1] >= arrow:
				if burst[j] == 0:
					burst[j] = 1
					res += 1
	return res

if __name__ == '__main__':
	# points = [[10, 16], [2, 8], [1, 6], [7, 12],[3,6]]
	# a=sorted(points,key=lambda ballon:ballon[1])
	# b=sorted(points,key=lambda ballon:ballon[0])
	# print(points)
	# print(a)
	# print(b)
	# points.sort(key=lambda a:a[0])
	# print(points)
	# points.sort(key=lambda a:a[1])
	# print(points)

	# a=[20,6,8,17,3,6,11,45]
	# print(a.index(45))

	points=	[[10, 16], [2, 8], [1, 6], [7, 12]]
	print(findMinArrowShots(points))